package com.lyf.pojo;

import java.util.List;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="t_user")
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public class User {
	private String id;
	private String username;
	private String password;
	private String email;
	private String createtime;
	private boolean enable;
	private String pic;
	private Group group;
	private List<Contact> contactList;
	private List<Contactnote> contactnoteList;
	private Set<Deal> dealSet;
	private Set<Dealnote> dealnoteSet;
	private Set<Task> taskSet;
	private Set<Message> messageSet;
	
	@Id
	@GenericGenerator(name="PK",strategy="uuid")
	@GeneratedValue(generator="PK")
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getCreatetime() {
		return createtime;
	}
	public void setCreatetime(String createtime) {
		this.createtime = createtime;
	}
	public boolean isEnable() {
		return enable;
	}
	public void setEnable(boolean enable) {
		this.enable = enable;
	}
	public String getPic() {
		return pic;
	}
	public void setPic(String pic) {
		this.pic = pic;
	}
	
	@ManyToOne
	@JoinColumn(name="groupid")
	public Group getGroup() {
		return group;
	}
	public void setGroup(Group group) {
		this.group = group;
	}
	
	@OneToMany(mappedBy="user")
	public List<Contact> getContactList() {
		return contactList;
	}
	public void setContactList(List<Contact> contactList) {
		this.contactList = contactList;
	}
	
	@OneToMany(mappedBy="user")
	public List<Contactnote> getContactnoteList() {
		return contactnoteList;
	}
	public void setContactnoteList(List<Contactnote> contactnoteList) {
		this.contactnoteList = contactnoteList;
	}
	
	@OneToMany(mappedBy="user")
	public Set<Deal> getDealSet() {
		return dealSet;
	}
	public void setDealSet(Set<Deal> dealSet) {
		this.dealSet = dealSet;
	}
	
	@OneToMany(mappedBy="user")
	public Set<Dealnote> getDealnoteSet() {
		return dealnoteSet;
	}
	public void setDealnoteSet(Set<Dealnote> dealnoteSet) {
		this.dealnoteSet = dealnoteSet;
	}
	
	@OneToMany(mappedBy="user")
	public Set<Task> getTaskSet() {
		return taskSet;
	}
	public void setTaskSet(Set<Task> taskSet) {
		this.taskSet = taskSet;
	}
	
	@OneToMany(mappedBy="user")
	public Set<Message> getMessageSet() {
		return messageSet;
	}
	public void setMessageSet(Set<Message> messageSet) {
		this.messageSet = messageSet;
	}
	
}
